<template>
  <common-page
    ref="commonPage"
    :bg-path="bgPath"
    :web-path="webPath"
    :columns="columns"
    :search-items="searchItems"
    :form-items="formItems"
  />
</template>
<script>
export default {
  data() {
    return {
      // ===== ===== ===== ===== 全局属性 ===== ===== ===== =====
      // 后台接口路径
      bgPath: 'clinic/evaluate/evaluate/clinicqual',
      // Web路径
      webPath: 'clinic/Evaluate/Evaluate/ClinicQual',
      // ===== ===== ===== ===== 页面配置 ===== ===== ===== =====
      // 搜索内容
      searchItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false
              }
            },
            {
              code: "name",
              name: "名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "storeCode",
              name: "门店编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "typeSign",
              name: "资质类型",
              type: "select",
              span: 6,
              config: {
                edit: false,
                options: [
                  {
                    key: "1",
                    value: "诊疗"
                  }, {
                    key: "2",
                    value: "理疗"
                  }
                ]
              }
            },
            {
              code: "treatmentQualCode",
              name: "诊疗资质编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "treatmentQualName",
              name: "诊疗资质名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyQualCode",
              name: "理疗资质编码",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "therapyQualName",
              name: "理疗资质名称",
              type: "text",
              span: 6,
              config: {
                edit: false
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                options: [
                  { key: "1", value: "申请" },
                  { key: "2", value: "通过" },
                  { key: "3", value: "未通过" }
                ]
              }
            }
          ]
        }
      ],
      // 列表内容
      columns: [
        {
          code: "code",
          name: "编码",
          span: 6,
          type: "text",
          config: {
            edit: false
          }
        },
        {
          code: "name",
          name: "名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "storeCode",
          name: "门店编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "storeName",
          name: "门店名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "typeSign",
          name: "资质类型",
          type: "select",
          span: 6,
          config: {
            edit: false,
            options: [
              {
                key: "1",
                value: "诊疗"
              }, {
                key: "2",
                value: "理疗"
              }
            ]
          }
        },
        {
          code: "treatmentQualCode",
          name: "诊疗资质编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "treatmentQualName",
          name: "诊疗资质名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyQualCode",
          name: "理疗资质编码",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "therapyQualName",
          name: "理疗资质名称",
          type: "text",
          span: 6,
          config: {
            edit: false
          }
        },
        {
          code: "stateSign",
          name: "状态标识",
          type: "select",
          span: 6,
          config: {
            edit: false,
            options: [
              { key: "1", value: "申请" },
              { key: "2", value: "通过" },
              { key: "3", value: "未通过" }
            ]
          }
        }
      ],
      // 增加/修改/详情 表单
      formItems: [
        {
          rowIndex: 1,
          items: [
            {
              code: "code",
              name: "编码",
              span: 6,
              type: "text",
              config: {
                edit: false,
                rules: [
                  { required: true, message: '请输入编码', trigger: 'blur' }
                ]
              }
            },
            {
              code: "name",
              name: "名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                rules: [
                  { required: true, message: '请输入名称', trigger: 'blur' }
                ]
              }
            },
            {
              code: "storeCode",
              span: 6,
              name: "门店编码",
              type: "popup",
              config: {
                url: "base/user/user/store",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                rules: [
                  { required: true, message: '请选择门店', trigger: 'change' }
                ]
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  this.$refs.commonPage.updateFormData(code, row.code)
                  this.$refs.commonPage.updateFormData("storeName", row.name)
                  this.$refs.commonPage.updateFormData("storeId", row.id)
                }
              }
            },
            {
              code: "storeName",
              name: "门店名称",
              span: 6,
              type: "text",
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "typeSign",
              name: "资质类型",
              type: "select",
              span: 6,
              config: {
                edit: false,
                options: [
                  {
                    key: "1",
                    value: "诊疗"
                  }, {
                    key: "2",
                    value: "理疗"
                  }
                ]
              }
            },
            {
              code: "treatmentQualCode",
              name: "诊疗资质编码",
              type: "popup",
              span: 6,
              config: {
                url: "clinic/evaluate/evaluate/treatmentqual",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                rules: [
                  { required: true, message: '请选择诊疗资质', trigger: 'change' }
                ]
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  this.$refs.commonPage.updateFormData(code, row.code)
                  this.$refs.commonPage.updateFormData("treatmentQualName", row.name)
                  this.$refs.commonPage.updateFormData("treatmentQualId", row.id)
                }
              }
            },
            {
              code: "treatmentQualName",
              name: "诊疗资质名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "therapyQualCode",
              name: "理疗资质编码",
              type: "popup",
              span: 6,
              config: {
                url: "clinic/evaluate/evaluate/therapyqual",
                filedList: [
                  { code: 'code', name: '编码' },
                  { code: 'name', name: '名称' }
                ],
                searcher: {},
                defaultValue: "",
                minLength: 0,
                maxLength: 20,
                disabled: false,
                rules: [
                  { required: true, message: '请选择理疗资质', trigger: 'change' }
                ]
              },
              handleEvent: {
                /**
                 * 开窗组件被选择
                 * @param code
                 * @param row
                 */
                onPopupClick: (code, row) => {
                  this.$refs.commonPage.updateFormData(code, row.code)
                  this.$refs.commonPage.updateFormData("therapyQualName", row.name)
                  this.$refs.commonPage.updateFormData("therapyQualId", row.id)
                }
              }
            },
            {
              code: "therapyQualName",
              name: "理疗资质名称",
              type: "text",
              span: 6,
              config: {
                edit: false,
                disabled: true
              }
            },
            {
              code: "stateSign",
              name: "状态标识",
              type: "select",
              span: 6,
              config: {
                edit: false,
                options: [
                  { key: "1", value: "申请" },
                  { key: "2", value: "通过" },
                  { key: "3", value: "未通过" }
                ]
              }
            }
          ]
        }
      ]
    }
  }
}
</script>
